POV-Ray : Newsgroups : povray.newusers : Double like a bridge : Re: Double like a bridge Server Time
30 Jul 2024 06:24:29 EDT (-0400)
  Re: Double like a bridge  
From: Slime
Date: 2 Sep 2004 15:49:41
Message: <41377955$1@news.povray.org>
> I'm traying to double this objecte like a bridge, but I only want to
double
> in the middle of it, the extremes should be straights. I don't know who
can
> I do it. Can anyone help me?


If I understand the effect you're going for, you might be able to place the
spheres in a parabolic shape (this code hasn't been tested):

#declare Bridge_Width = 5.0; // set to whatever
#declare Bridge_Height = 2.0; // set to whatever

#while (HM_Blobs_remanente>0)
 #local blobnum = HM_Blobs_remanente - 1; // (easier to start with index 0)
 #local blobamnt = blobnum / (How_many_blobs-1) // (number from 0.0 to 1.0)
 #local blobamnt = blobamnt * 2.0 - 1.0; // (now from -1.0 to 1.0)

 sphere { <blobamnt * Bridge_Width*0.5, (1-pow(blobamnt,2)) * Bridge_Height,
0> 1 , 1 }

 #local HM_Blobs_remanente = HM_Blobs_remanente-1 ;
#end

This will place the spheres along a curved path from <-Bridge_Width/2,0,0>
to <0,Bridge_Height,0> to <Bridge_Width/2,0,0>.

The tricky part is the (1-pow(blobamnt,2)), which takes a number from -1 to
1 (which represents how far across the bridge the current blob sphere is),
squares it (to get a number from 0 to 1, higher at the edges of the bridge)
and then subtracts that from one (to get a number from 0 to 1, now lower at
the edges of the bridge).

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.